/**
 * Created by Administrator on 2017/3/25.
 */
public class Commodity {
    private int id;
    private String name;
    private double price;

    public Commodity(int id, String name, double price) {
        this.id = id;
        this.name = name;
        this.price = price;
    }

    @Override
    public String toString()
    {
        return this.name+'-'+this.price+'-'+this.id;
    }

    @Override
    public boolean equals(Object obj)
    {
        if(obj instanceof Commodity) {
            Commodity c = (Commodity) obj;
            return this.id==c.id&&this.name.equals(c.name)&&this.price==c.price;

        }
        else return super.equals(obj);
    }
}
